package org.jeecg.common.util.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * @author guoyh
 * @ClassName AppUpgradeStrategyEnum
 * @Description
 * @since 2020/9/6 16:08
 **/
@Getter
@AllArgsConstructor
public enum AppUpgradeStrategyEnum {

    NONE(0,"无需升级",null),
    UPGRADE(1,"选择升级",false),
    FORCE_UPGRADE(2,"强制升级",true);

    private int code;

    private String desc;

    private Boolean forceUpgrade;


    public static AppUpgradeStrategyEnum getInstance(Boolean forceUpgrade){
        return Arrays.stream(values()).filter(item -> Objects.equals(forceUpgrade,item.getForceUpgrade())).findFirst().orElse(null);
    }
}
